/**
 * Created by KhoaNam on 6/25/2014.
 */
var PlayScene = cc.Scene.extend({
    ctor: function(player, dice, dora, dice1, dice2){
        this._super();
        this.currPlayer = player;
        this.dice = dice;
        this.dora = dora;
        this.dice1 = dice1;
        this.dice2 = dice2;
        this.statusLayer  = null;
        this.animationLayer = null;
        this.backgroundLayer = null;
        isPlaying = true;
    },

    onEnter: function(){
        this._super();
        var backgroundLayer = new BackgroundLayer();
        this.addChild(backgroundLayer, 1);
        backgroundLayer.init();
        this.backgroundLayer = backgroundLayer;

        var statusLayer = new StatusLayer();
        this.addChild(statusLayer, 2);
        statusLayer.init();
        this.statusLayer = statusLayer;

        var animationLayer = new AnimationLayer(statusLayer.inforBackgroundSprite.getBoundingBox(), this.currPlayer, this.dice, this.dora);
        this.animationLayer = animationLayer;
        this.addChild(animationLayer,3);
        animationLayer.init();
    },

    reset: function(){
        this.statusLayer.removeAllChildren();
        this.animationLayer.removeAllChildren();
        this.animationLayer.callFINISH();
        this.backgroundLayer.removeAllChildren();
    }
});